package com.hjc.oj.judge.codesandbox;

import com.hjc.oj.judge.codesandbox.impl.ExampleCodeSandBox;
import com.hjc.oj.judge.codesandbox.impl.RemoteCodeSandBox;
import com.hjc.oj.judge.codesandbox.impl.ThirdPartyCodeSandBox;

/**
 * 代码沙箱静态工厂
 */
public class CodeSandBoxFactory {

    /***
     * 创建代码沙箱，根据type
     * @param type 类型
     * @return CodeSandBox
     */
    public static CodeSandBox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandBox();
            case "remote":
                return new RemoteCodeSandBox();
            case "thirdParty":
                return new ThirdPartyCodeSandBox();
            default:
                return new ExampleCodeSandBox();
            }
        }

}
